package com.yal.timer.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

/**
 * @author Kimiaaaaa
 * @date 2022年04月19日 15:29
 */
@Configuration
public class BeanConfig {
        @Bean
        public TaskScheduler taskScheduler(){

            ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();

            taskScheduler .setPoolSize(5);//定义线程池数量为5 个

            return taskScheduler ;

        }
}
